<?php
header("Content_Type:application/json;charset=utf-8");

if(isset($_REQUEST["pid"])){
    $pid=$_REQUEST["pid"];
//    $goodsListstr=(file_get_contents("./data/goodList.json"));
    $goodsListstr=file_get_contents("./data/goodList.json");
    $goodsListArr=json_decode($goodsListstr);
    for($i=0;$i<count($goodsListArr);$i++){
        if($goodsListArr[$i]->pid==$pid){
            print_r(json_encode($goodsListArr[$i]));
            break;
        }
    }
}else{
    print_r(file_get_contents("./data/goodList.json"));
}

////function removeBOM($data) {
////    if (0 === strpos(bin2hex($data), 'efbbbf')) {
////        return substr($data, 3);
////    }
////    return $data;
//}